use chrono::{NaiveDateTime, NaiveTime};
use crate::mock_exchange::{Transaction, Tick};

pub struct Strategy {}

impl Strategy {
    fn on_transaction(&self, t: Transaction) {}

    fn on_tick(&self, t: Tick) {}

    fn on_order(&self, order: Order) {}
}


#[derive(Clone, Copy, Eq, PartialEq)]
pub enum Direction {
    Buy,
    Sell,
}

pub enum OrderType {
    Market,
    Limit,
}


pub struct Order {
    pub strategy_id: String,
    pub order_id: String,
    pub stock_id: String,
    pub direction: Direction,
    pub time: NaiveDateTime,
    pub volume: i64,
    pub price: f64,
    pub order_type: OrderType,
    pub deal_volume: i64,
    pub deal_price: f64,
}

impl Order {
    pub fn exchange_id(&self) -> String {
        format!("{}-{}", self.strategy_id, self.order_id)
    }
}